#ifndef _BUTTON_H_
#define _BUTTON_H_

#include "../bitpointer/BitPointer.h"
#include "../device/Device.h"
#include "../counter/Counter.h"

/*
	class : Button
	desc : This class represents a simple button
		if held down for x amount it will return as 
		being pressed until it is reset.
*/
class Button : public Device
{
	private:
		//determines how long the button must be
		//held before it returns it has been pressed.
		Counter<unsigned char> buttonCounter; 
		//the value of the unpressed state of the button
		unsigned char unpressedValue; 
		//determines if the button has been pressed.
		bool pressed;
		//determines if button is being held
		bool held;
		//pointer to bit that is acting as a button.
		BitPointer button;

	public:
		//default constructor
		Button();
		//constructor takes in count required before button is pressed
		//unpressed value and the bitpointer v
		Button(unsigned char min, BitPointer v, unsigned char unpressed);
		//same as before except it takes in a counter instead of the 
		//value for the counter.
		Button(Counter<unsigned char> c, BitPointer v, 
			unsigned char unpressed);
		//resets the pressed state of the button needed
		void reset();
		//determines if the button is held
		bool isHeld();
		//determines if the button is pressed
		unsigned char isPressed();
		//runs the button accordingly.
		void run();
};



#endif

